A=[1 1 1 0 0 0 0 0 0;
   0 0 0 1 1 1 0 0 0;
   0 0 0 0 0 0 1 1 1;
   1 0 0 0 1 0 0 0 1;
   0 1 0 0 0 1 0 0 0;
   0 0 0 1 0 0 0 1 0;
   0 0 0 0 0 1 0 1 0;
   0 0 1 0 1 0 1 0 0;
   0 1 0 1 0 0 0 0 0;
   1 0 0 1 0 0 1 0 0;
   0 1 0 0 1 0 0 1 0;
   0 0 1 0 0 1 0 0 1];
B=[12 9 4 8 10 1 7 9 4 4 8 13]';
AT=A(1:9,1:9);
BT=B(1:9,1);